<?php if ($updates):?>

<?php $currdate = ''; foreach($updates as $key => $update):?>

	<?php $first = false; if ($currdate !== $update->dateapplicable):?>
		
	<h3 class="thedate"><?=date('l jS F' , strtotime($update->dateapplicable));?></h3>
	
	<?php $first = true;$currdate = $update->dateapplicable; endif;?>

<li id="timesheet-<?=$update->id;?>" class="clearfix date-wgo-<?=date('Ymd' , strtotime($update->dateapplicable));?>">
	
	<div class="meta">
		<span class="<?=$update->update_type;?>"><?=$update->update_type;?></span>
		<a class="gravatar" style="background-image: url(<?="http://www.gravatar.com/avatar.php?size=45&default=".urlencode(base_url().'assets/epicentr/images/defaultperson.png')."&gravatar_id=".md5(trim($update->emailaddress));?>);" href=""><?=$update->firstname;?> <?=$update->lastname;?></a>
	</div>
	
	<div class="content">
		<p style="margin-bottom: 20px">
			
			<?php if ($update->activity_title):?>
			<strong><a href="<?=site_url('jobs/showUpdates/'.$update->jobid.'#timesheet-'.$update->id);?>"><?=$update->activity_title;?></a></strong> in <?php endif;?> 
			<?php if ($update->centertitle):?><strong><a href="<?=site_url('jobs/showUpdates/'.$update->jobid);?>"><?=$update->centertitle;?></a></strong> on 
			<?php endif;?><a href="<?=site_url('jobs/showUpdates/'.$update->jobid);?>"><strong><?=$update->job_title;?></a></strong> for 
			<strong><a href="<?=site_url('companies/view/'.$update->companyid);?>"><?=$update->company_name;?></a></strong>
			<?php if (!$update->notbillable && $permissions->showupdatetime):?>(<em><?= floor($update->hoursworked);?>hrs <?=intval( ($update->hoursworked - floor($update->hoursworked)) * 60);?>mins</em>)<?php endif;?>
		</p>

	<div id="<?=$update->id;?>|timesheet|notes"><?=$this->typography->auto_typography(ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\" rel=\"nofollow\" target=\"_blank\">\\0</a>", $update->notes));?></div>
	
	<?php if (isset($update->files) && $update->files):?>
		<h4 class="attached">Attachments</h4>
		<div class="attached">
			<?php foreach($update->files as $key => $file):?>
				<p>
				<?php if($file->googledocsid):?>
					<a href="<?=site_url('files/download/'.$file->id);?>" title="Download this Document" class="<?=url_title($file->file_type);?>"><?=$file->title;?></a><br />
					<iframe width="550" border="0" height="400" src="YOURGOOGLEDOCS/Doc?id=<?=$file->googledocsid;?>&amp;hl=en_GB"></iframe>
				<?php elseif ( in_array($file->file_type, array('application/pdf') ) ):?>
					<a href="<?=site_url('files/download/'.$file->id);?>" title="Download this pdf" class="<?=url_title($file->file_type);?>"><?=$file->title;?></a><br />
					<a href="<?=site_url('files/download/'.$file->id);?>" title="Download this pdf"><img src="<?= resizedImageURL($file->file_path.$file->file_name, 250, 5, true, 'width')  ;?>" style="border: 1px solid #ccc;" /></a>
				<?php elseif ( in_array($file->file_type, array('image/gif', 'image/jpeg', 'image/png') ) ):?>
					<a href="<?=site_url('files/download/'.$file->id);?>" title="Download this image" class="<?=url_title($file->file_type);?>"><?=$file->title;?></a><br />
					<a href="<?=site_url('files/download/'.$file->id);?>" title="Download this image"><img src="<?= resizedImageURL($file->file_path.$file->file_name, 250, 5, true, 'width')  ;?>" /></a>
				<?php else:?>
					<a href="<?=site_url('files/download/'.$file->id);?>"><?=$file->title;?> (<?=$file->file_size;?>k)</a>
				<?php endif;?>
				</p>
			<?php endforeach;?>
		</div>
	<?php endif;?>
	
	<?php if (isset($candelete) && $candelete && $permissions->deleteupdates):?>
	
	<a class="delete">Delete</a>

	<?php endif;?>
	</li>
	</div>
	
<?php endforeach;?>
<?php endif;?>
